home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / biz / dopus / DOpusRxTrash.lha / TrashcanOfDaveClarke.dopus5 < prev   
Text File  |  2001-06-07  |  4KB  |  143 lines

  1. /* Trashcan for Directory Opus 5.5
  2.    by Dave Clarke from an ieda of Stefano Regattin
  3.    $VER: TrashcanOfDaveClarke.dopus5 1.0 (2.2.2001)
  4. */
  5.  
  6. /* Change to suit */
  7. CestinoPieno  = 'ENVARC:Sys/def_trashcan'
  8. CestinoVuoto  = 'ENVARC:Sys/def_trashcan'
  9. ListaFileCestinati  = 'SYS:T/Eliminati'
  10.  
  11. Signal On Ferma
  12. Signal On CTRL_C
  13. Signal On Sintassi
  14.  
  15. LF = '0a'x
  16. Options Results
  17. Options FailAt 21
  18. Address 'DOPUS.1'
  19.  
  20. If Exists('LIBS:rexxsupport.library') Then
  21.  Call AddLib('rexxsupport.library',0,-30)
  22. Else
  23. Do
  24.  Call DisplayError('Richiede la rexxsupport.library')
  25.  Exit 20
  26. End
  27.  
  28. NomePorta = 'trashport'
  29. If ~OpenPort(NomePorta) Then
  30. Do
  31.  Say 'Non posso mettere il cestino!'
  32.  Exit
  33. End
  34.  
  35. MenuCestino.count = 3
  36. MenuCestino.0 = 'Ricicla'
  37. MenuCestino.1 = '---'
  38. MenuCestino.2 = 'Elimina'
  39.  
  40. ReInit:
  41. If Exists(ListaFileCestinati) then
  42.  ImmagineCestino = CestinoPieno
  43. Else
  44.  ImmagineCestino = CestinoVuoto
  45. EndIf
  46.  
  47. Dopus AddAppIcon 'trashport' 'Cestino' 8111966 icon iconimage info snap close local quotes menu MenuCestino
  48. Icona = Result
  49.  
  50. Segnale = 0
  51. Do While Segnale = 0
  52.  If Waitpkt(NomePorta) Then
  53.  Do
  54.   Pacchetto   = GetPkt(NomePorta)
  55.   Evento      = GetArg(Pacchetto,0)
  56.   ID          = GetArg(Pacchetto,1)
  57.   NomiDeiFile = GetArg(Pacchetto,2)
  58.   Gestione    = GetArg(Pacchetto,3)
  59.   Call Reply(Pacchetto,0)
  60.  
  61.   Select
  62.   When event = 'dropfrom' Then
  63.    Do
  64.     NumeroFile = 0
  65.     Do While NomiDeiFile ~= ''
  66.      NumeroFile = NumeroFile + 1
  67.      Parse Var NomiDeiFile '"' File.NumeroFile '"' NomiDeiFile
  68.     End
  69.     If Gestione ~= 0 Then
  70.     Do
  71.      Lister Query Handle Path
  72.      Percorso = strip(result,'b','"')
  73.     End
  74.     If ~Exists(FileCestinati) Then Address Command 'Echo "Failat 21" >'FileCestinati
  75.     Do i = 1 To NumeroFile
  76.      If handle = 0 Then
  77.      Do
  78.       Percorso = Reverse(SubStr(Reverse(File.1), Verify(Reverse(File.1),':/','m', 2)))
  79.       File.i = Substr(File.i, Length(Percorso) + 1, Length(File.i) - Length(Percorso) - 1)
  80.      End
  81.      If Word(statef(Percorso||File.i), 1) = 'DIR' Then
  82.      Do
  83.       Address Command 'Run >NIL: <NIL: Copy "'Percorso||File.i'#?" 'trashcan' ALL CLONE'
  84.       Address Command 'Run >NIL: <NIL: Delete "'Percorso||File.i'#?" ALL QUIET FORCE'
  85.       Address Command 'Run >NIL: <NIL: Echo "Copy *"'trashcan||File.i'*" TO *"'Percorso||File.i'*" ALL CLONE" >>'delfiles
  86.      End
  87.     Else
  88.      Do
  89.       Address Command 'Run >NIL: <NIL: Copy "'Percorso||File.i'" 'trashcan
  90.       Address Command 'Run >NIL: <NIL: Delete "'Percorso||File.i'" QUIET FORCE'
  91.       Address Command 'Run >NIL: <NIL: Echo "Copy *"'trashcan||File.i'*" TO *"'Percorso||File.i'*"" >>'delfiles
  92.      End
  93.     End
  94.     Dopus Script 'Lasciato sul cestino'
  95.     Segnale = 3
  96.    End
  97.   When event = 'menu' Then
  98.    Do
  99.     Select
  100.     When NomiDeiFile = 0 Then
  101.      Do
  102.       Address Command 'Run >NIL: <NIL: Execute 'delfiles
  103.       Address Command 'Run >NIL: <NIL: Delete 'delfiles
  104.       Address Command 'Run >NIL: <NIL: Delete 'trashcan'#? QUIET FORCE'
  105.       Address Command 'Run >NIL: <NIL: Delete 'trashcan'#? ALL QUIET FORCE'
  106.       Call DisplayError('Ho riciclato tutti i file nei cestini')
  107.       Dopus Script 'Cestino riciclato'
  108.      End
  109.     When namestr = 2 Then
  110.      Do
  111.       Address Command 'Run >NIL: <NIL: Delete 'trashcan'#? QUIET FORCE'
  112.       Address Command 'Run >NIL: <NIL: Delete 'trashcan'#? ALL QUIET FORCE'
  113.       Address Command 'Run >NIL: <NIL: Delete 'delfiles' QUIET FORCE'
  114.       Call DisplayError('Ho vuotato tutti i cestini')
  115.       Dopus Script 'Cestino vuotato'
  116.      End
  117.     Otherwise Nop
  118.     End
  119.     Segnale = 3
  120.    End
  121.   When event = 'info' Then Call DisplayError('stefano.regattin@tin.it'lf'http://members.tripod.it/esseerre/Stefano.html')
  122.   When event = 'close' then Segnale = 1
  123.   When event = 'inactive' then Segnale = 2
  124.   Otherwise Nop
  125.  End
  126. End
  127.  
  128. Errore:
  129. Ferma:
  130. CTRL_C:
  131. Sintassi:
  132. Dopus SetAppIcon Icona BUSY OFF
  133. If Segnale ~= 2 then Dopus RemAppIcon Icona
  134. If Segnale = 3 then Signal ReInit
  135. Call ClosePort(NomePorta)
  136. Dopus Script 'Cestino rimosso'
  137. Exit
  138. DisplayError: Procedure Expose LF
  139. Parse Arg Message
  140. Command Flash
  141. Dopus Request '"'message'" OK'
  142. Return
  143.